<div class="langSelect">
<?php 
    if(sizeof($languages) < 3) 
    {
        // Render options as links
        $lastElement = end($languages);
		echo "<ul id='main-menu-right' class='nav pull-right'>";
        foreach($languages as $key=>$lang)
        {
//            if($key != $currentLang)
//            {
			$class = ($key == $currentLang) ? "active" : "";
                echo '<li class="'.$class.'">'.CHtml::link(
                     $lang, 
                     $this->getOwner()->createMultilanguageReturnUrl($key)).'</li>';
//            } 
//            else 
//			{
//				echo '<li>'.$lang.'</li>';
//			}
//            if($lang != $lastElement) 
//			{
//				echo ' | ';
//			}
        }
		echo '</ul>';
    }
    else 
	{
        // Render options as dropDownList
        echo CHtml::form();
        foreach($languages as $key=>$lang)
		{
            echo CHtml::hiddenField(
                $key, 
                $this->getOwner()->createMultilanguageReturnUrl($key));
        }
        echo CHtml::dropDownList('language', $currentLang, $languages,
            array(
                'submit'=>'',
            )
        ); 
        echo CHtml::endForm();
    }
?></div>
